<template>
	<div :ref="config.key" style="height: 100%"></div>
</template>

<script>
import * as echarts from 'echarts';
export default {
	name: "BarCharts",
	props:["config"],
	mounted(){
		this.$nextTick(function (){
			this.init();
		})
	},
	methods:{
		init(){
			let  option = {
				xAxis: {
					type: 'category',
					data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
				},
				yAxis: {
					type: 'value'
				},
				series: [
					{
						data: [120, 200, 150, 80, 70, 110, 130],
						type: 'bar'
					}
				]
			};
			let pieEl=this.$refs[this.config.key];
			let pieChart=echarts.init(pieEl);
			pieChart.setOption(option);
		},
        /**
         * @param args
         * component:触发过来的组件key
         * params:传递过来的参数
         */
        handReceive(args){

        }
	}
}
</script>

<style scoped>

</style>
